import {
  BaseEntity,
  Column,
  Entity,
  PrimaryColumn,
  PrimaryGeneratedColumn,
} from 'typeorm'

// 资产盘点表
@Entity({ name: 'inventory' })
export class Inventory extends BaseEntity {
  // 自增主键
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number

  // 盘点申请编号
  @PrimaryColumn({
    type: 'varchar',
    name: 'inventoryCode',
  })
  inventoryCode: string

  // 申请人
  @Column({
    type: 'varchar',
    name: 'receivePerson',
  })
  receivePerson: string

  // 申请人id
  @Column({
    type: 'int',
    name: 'receivePersonId',
  })
  receivePersonId: number

  // 申请部门
  @Column({
    type: 'varchar',
    name: 'receiveBranch',
    nullable: true,
  })
  receiveBranch: string

  // 申请部门id
  @Column({
    type: 'int',
    name: 'receiveBranchId',
    nullable: true,
  })
  receiveBranchId: number

  // 盘点名称
  @Column({
    type: 'varchar',
    name: 'inventoryName',
  })
  inventoryName: string

  // 盘点资产总数
  @Column({
    type: 'double',
    name: 'inventoryNumber',
  })
  inventoryNumber: number

  // 申请日期
  @Column({
    type: 'varchar',
    name: 'receiveDate',
  })
  receiveDate: string

  // 盘点人
  @Column({
    type: 'varchar',
    name: 'inventoryPerson',
  })
  inventoryPerson: string

  // 盘点人id
  @Column({
    type: 'int',
    name: 'inventoryPersonId',
  })
  inventoryPersonId: number

  // 盘点涉及仓库ids
  @Column({
    type: 'varchar',
    name: 'warehouseIds',
  })
  warehouseIds: string

  // 盘点状态 0 进行中 1 盘点完成
  @Column({
    type: 'varchar',
    name: 'inventoryType',
  })
  inventoryType: string

  // 备注
  @Column({
    type: 'varchar',
    name: 'remark',
    nullable: true,
  })
  remark: string

  // 是否删除
  @Column({
    type: 'tinyint',
    name: 'isDelete',
    nullable: true,
  })
  isDelete: boolean
}
